class Product {
  constructor(name) {
    this.name = name
  }
  init() {
    alert(`name: ${this.name}`)
  }
}

class Creator {
  create(name) {
    return new Product(name)
  }
}

// 测试
let creator = new Creator()
let p = creator.create('p1')
p.init()
